         function echeck(str)
         {
		    var at="@"
		    var dot="."
		    var lat=str.indexOf(at)
		    var lstr=str.length
		    var ldot=str.indexOf(dot)
		    if (str.indexOf(at)==-1)
		    {
		       return false
		    }

		    if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		    {
		       return false
		    }

		    if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
		    {
		       return false
		    }

		    if (str.indexOf(at,(lat+1))!=-1)
		    {
		       return false
		    }

		    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		    {
		       return false
		    }

		    if (str.indexOf(dot,(lat+2))==-1)
		    {
		       return false
		    }

		    if (str.indexOf(" ")!=-1)
		    {
		       return false
		    }

 		    return true
	     }

         function validate(form)
         {
            var errorMsg = "";

            var name = form.nameBox.value;
            var telephone = form.telephoneBox.value;
            var email = form.emailBox.value;
			var detailsBox = form.detailsBoxID.value;

            if(name == '' || telephone == '' || email == '' || detailsBox == '')
            {
               if(name == '')
               {
                  errorMsg = errorMsg + "Please Enter Your Name !! \n";
               }
               if(telephone == '')
               {
                  errorMsg = errorMsg + "Please Enter Your telephone !! \n";
               }
               if(email == '')
               {
                  errorMsg = errorMsg + "Please Enter Your E-mail address !! \n";
               }
               if(detailsBox == '')
               {
                  errorMsg = errorMsg + "Please Enter Your Comments/Feedback !! \n";
               }
               alert(errorMsg);
			   
               return false;
			   
            }
            else 
            {
				
               if(echeck(email) == false)
               {
                  alert("Invalid E-mail ID");
                  return false;
               }
               return true;
            }
         }

function checkNum(x)
{
			 
	  var s_len=x.value.length ;
	  var s_charcode = 0;
		for (var s_i=0;s_i<s_len;s_i++)
		{
		 s_charcode = x.value.charCodeAt(s_i);
		 if(!(((s_charcode>=48 && s_charcode<=57)|| s_charcode==43 || s_charcode==45 )))
		  {
				 alert("Only Number Allowed");
				 x.value='';
				 x.focus();
   				 return false;			 
		  }
		}
		return true;
}
